commonlibsse_ng\re\p\PlayerCharacter/
skill.rs

1#[repr(C)]
2#[derive(Debug, Clone, PartialEq)]
3pub struct PlayerSkills {
4    data: *mut Data,
5}
6const _: () = assert!(core::mem::size_of::<PlayerSkills>() == 0x8);
7
8/// Skill data
9#[repr(C)]
10#[derive(Debug, Default, Clone, PartialEq)]
11pub struct Data {
12    pub xp: f32,
13    pub levelThreshold: f32,
14    pub skills: [SkillData; Skill::TOTAL],
15    pub legendaryLevels: [u32; Skill::TOTAL],
16}
17const _: () = assert!(core::mem::size_of::<Data>() == 0x128);
18
19#[repr(C)]
20#[derive(Debug, Default, Clone, PartialEq)]
21pub struct SkillData {
22    pub level: f32,          // 0x00
23    pub xp: f32,             // 0x04
24    pub levelThreshold: f32, // 0x08
25}
26const _: () = {
27    assert!(core::mem::offset_of!(SkillData, level) == 0x0);
28    assert!(core::mem::offset_of!(SkillData, xp) == 0x4);
29    assert!(core::mem::offset_of!(SkillData, levelThreshold) == 0x8);
30    assert!(core::mem::size_of::<SkillData>() == 0xC);
31};
32
33#[commonlibsse_ng_derive_internal::ffi_enum]
34#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
35#[repr(u32)]
36pub enum Skill {
37    #[default]
38    OneHanded = 0,
39    TwoHanded = 1,
40    Archery = 2,
41    Block = 3,
42    Smithing = 4,
43    HeavyArmor = 5,
44    LightArmor = 6,
45    Pickpocket = 7,
46    Lockpicking = 8,
47    Sneak = 9,
48    Alchemy = 10,
49    Speech = 11,
50    Alteration = 12,
51    Conjuration = 13,
52    Destruction = 14,
53    Illusion = 15,
54    Restoration = 16,
55    Enchanting = 17,
56}
57
58impl Skill {
59    pub const TOTAL: usize = 18;
60
61    #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 40560, ae_id = 41567)]
62    pub fn advance_level(&mut self, add_threshold: bool) {}
63}